{extend name="platform/base" /}
{block name="resources"/}
<link rel="stylesheet" type="text/css" href="ADMIN_CSS/defau.css">
<script src="ADMIN_JS/art_dialog.source.js"></script>
<script src="ADMIN_JS/iframe_tools.source.js"></script>
<script src="ADMIN_JS/material_managedialog.js"></script>
<style>

    .radio {
        font-weight:300;
    }
</style>
{/block}
{block name="main"}
<input type="hidden" id="withdraw_id" value="{$list['id']}">
<section class="panel panel-default">
    <header class="panel-heading font-bold"> 企业详情 </header>
    <div class="panel-body">
            <div class="form-group">
                <label class="col-sm-2 control-label"><span class="color-red">*</span>企业名称</label>
                <div class="col-md-3">
                    <b><?php echo $list['name'] ?></b>
                </div>
                <p class="error"></p>
            </div>

        <div class="form-group">
            <label class="col-sm-2 control-label"><span class="color-red">*</span>企业描述</label>
            <div class="col-md-3">
                <b><?php echo $list['desc'] ?></b>
            </div>
            <p class="error"></p>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label"><span class="color-red">*</span>企业地址</label>
            <div class="col-md-3">
                <b><?php echo $list['address'] ?></b>
            </div>
            <p class="error"></p>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label"><span class="color-red">*</span>入驻原因</label>
            <div class="col-md-3">
                <b><?php echo $list['details'] ?></b>
            </div>
            <p class="error"></p>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label"><span class="color-red">*</span>审核状态</label>
            <div class="col-md-3">
                <b><?php echo $list['str_status'];?></b>
            </div>
            <p class="error"></p>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label"><span class="color-red">*</span>企业图片</label>
            <div class="col-md-3">
                <?php echo ($list['image']);?>
            </div>
            <p class="error"></p>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label"><span class="color-red">*</span>注册时间</label>
            <div class="col-md-3">
                <b><?php echo $list['created_at'] ?></b>
            </div>
            <p class="error"></p>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label"><span class="color-red">*</span>审核时间</label>
            <div class="col-md-3">
                <b><?php echo $list['updated_at'] ?></b>
            </div>
            <p class="error"></p>
        </div>
        <?php  if( $list['status'] == 0):?>
        <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <div class="col-sm-4 col-sm-offset-2">
                    <a href="javascript:void(0);" onclick="Adopt()" class="btn btn-primary">通过</a>
                    <a href="javascript:void(0);" onclick="Reject()" class="btn btn-primary">驳回</a>
                </div>
            </div>
        <div class="form-group">
            <input placeholder="请输入驳回原因" type="text" class="form-control" id="method" value="" onkeydown="error_hide()">
            <b class="reject_error" style="color: red ;display: none;" >* 填写驳回原因</b>
        </div>
        <?php elseif($list['status'] > 0):?>
        <b style="color: #0BB20C">审核通过</b>

        <?php else:?>
        <div class="form-group">
            <label class="col-sm-2 control-label"><span class="color-red">*</span>驳回原因</label>
            <div class="col-md-3">
                <b style="color: red"><?php echo $list['reject_details'] ?></b>
            </div>
            <p class="error"></p>
        </div>
        <?php endif;?>


    </div>
</section>

<script src="ADMIN_JS/ajax_file_upload.js" type="text/javascript"></script>
<script src="__STATIC__/js/file_upload.js" type="text/javascript"></script>
<script>

    var validation = true;//验证余额输入
    /* $("#poundage").live("keyup",function(){
        var reg = /^\d+(.{0,1})(\d{0,2})$/;
        if(!reg.test($(this).val())){
            showTip("请输入大于0的数字，并且保留两位小数","warning");
            validation = false;
        }else{
            validation = true;
        }
    }) */
    function setMemberwithdrawAjax() {
        var is_use = $("input[type='radio'][name='enable']:checked").val();
        var cash_min = $("#cash_min").val();
        var multiple = $("#multiple").val();
        // var poundage = $("#poundage").val();
        var poundage = 0;
        var message = $("#message").val();

        var withdraw_account = new Array();
        $("input[name='withdraw_account']:checked").each(function(){
            withdraw_account.push($(this).val());
        });

        if(cash_min == ''){
            $("#cash_min").focus().parent().next().html("请输入提现金额").show();
            return false;
        }else if(!(cash_min>0)){
            $("#cash_min").focus().parent().next().html("最低提现金额必须大于0").show();
            return false;
        }

        if(multiple == ''){
            $("#multiple").focus().parent().next().html("请输入提现倍数").show();
            return false;
        }else if(!(/^\+?[1-9]\d*$/).test(multiple)){
            $("#multiple").focus().parent().next().html("提现倍数必须为大于0的整数").show();
            return false;
        }

        if(withdraw_account.length == 0){
            showTip("至少选择一个提现账户","warning");
            return;
        }

        if(validation){
            $.ajax({
                type : "post",
                url : "{:__URL('PLATFORM_MAIN/config/memberwithdrawsetting')}",
                data : {
                    'cash_min' : cash_min,
                    'multiple' : multiple,
                    'poundage' : poundage,
                    'message' : message,
                    'is_use' : is_use,
                    'withdraw_account' : withdraw_account.toString()
                },
                success : function(data) {
                    //alert(JSON.stringify(data));
                    if (data['code'] > 0) {
                        showMessage('success',"提交成功");
                    } else {
                        showMessage('error',"提交失败");
                    }
                }
            });
        }else{
            showMessage("请输入大于0的数字，并且保留两位小数","warning");
        }
    }
    window.onload=function(){
        var is_open = $("#is_open").val();
        if(is_open == ''){
            is_open = 0;
        }
        if(parseInt(is_open) == 0){
            $("#enableNo").prop("checked","checked");
        }else{
            $("#enableYes").prop("checked","checked");
        }
    }

    function Reject() {
        var id = $('#withdraw_id').val()
        var method = $("#method").val()
        if(method == ""){
            $(".reject_error").show();
            return false
        }
        $( "#dialog" ).dialog({
            buttons: {
                "确定": function() {
                    $(this).dialog('close');
                    $.ajax({
                        type : "post",
                        url : "{:__URL('PLATFORM_MAIN/Settled/reject')}",
                        async : true,
                        data : {
                            "id" : id,
                            "status" : -1,
                            "reject_info" : method
                        },
                        success : function(data) {
                            window.location.reload()
                        }
                    })
                },
                "取消,#e57373": function() {
                    $(this).dialog('close');
                }
            },
            contentText:"是否“驳回”该公司入驻？",
        });
    }

    function Adopt() {
        var id = $('#withdraw_id').val()

        $( "#dialog" ).dialog({
            buttons: {
                "确定": function() {
                    $(this).dialog('close');
                    $.ajax({
                        type : "post",
                        url : "{:__URL('PLATFORM_MAIN/Settled/reject')}",
                        async : true,
                        data : {
                            "id" : id,
                            "status" : 1
                        },
                        success : function(data) {
                            window.location.reload()
                        }
                    })
                },
                "取消,#e57373": function() {
                    $(this).dialog('close');
                }
            },
            contentText:"是否“同意”该公司入驻？",
        });
    }
</script>
{/block}